﻿package mortal.game.proxy
{
    import Framework.Util.*;
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import com.gengine.debug.*;
    import com.gengine.global.*;
    import extend.language.*;
    import flash.utils.*;
    import mortal.common.error.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.view.common.cd.*;
    import mortal.game.view.daily.*;
    import mortal.game.view.drugBack.*;
    import mortal.game.view.firstReCharge.*;
    import mortal.mvc.core.*;

    public class RoleProxy extends Proxy
    {
        private var _finalTestRewardId:int = -1;

        public function RoleProxy()
        {
            return;
        }// end function

        public function learnSkill(param1:int, param2:Boolean = true) : void
        {
            rmi.iRolePrx.learnSkill_async(new AMI_IRole_learnSkill(this.learnSkillSuccess, null, param1), param1, param2);
            return;
        }// end function

        private function learnSkillSuccess(param1:AMI_IRole_learnSkill) : void
        {
            var _loc_2:* = int(param1.userObject);
            var _loc_3:* = SkillConfig.instance.getInfoById(_loc_2);
            if (_loc_3 != null)
            {
                MsgManager.addTipText(Language.getStringByParam(20254, _loc_3.name), MsgHistoryType.SkillMsg);
            }
            return;
        }// end function

        public function upgradeSkill(param1:int, param2:Boolean = true) : void
        {
            rmi.iRolePrx.upgradeSkill_async(new AMI_IRole_upgradeSkill(this.upgradeSkillSuccess, null, param1), param1, param2);
            return;
        }// end function

        private function upgradeSkillSuccess(param1:AMI_IRole_upgradeSkill) : void
        {
            var _loc_2:* = int(param1.userObject);
            var _loc_3:* = SkillConfig.instance.getInfoById(_loc_2);
            if (_loc_3 != null)
            {
                MsgManager.addTipText(Language.getStringByParam(20255, (_loc_3.skillLevel + 1), _loc_3.name), MsgHistoryType.SkillMsg);
            }
            return;
        }// end function

        public function dreesRune(param1:String = null, param2:String = null) : void
        {
            rmi.iRolePrx.dressRune_async(new AMI_IRole_dressRune(this.dressRuneSuccess), param1, param2);
            return;
        }// end function

        private function dressRuneSuccess(param1:Object = null) : void
        {
            NetDispatcher.dispatchCmd(ServerCommand.RuneDressSuccess, param1);
            return;
        }// end function

        public function activeRune(param1:int, param2:Boolean = false) : void
        {
            rmi.iRolePrx.activeRune_async(new AMI_IRole_activeRune(), param1, param2);
            return;
        }// end function

        public function upgradeRune(param1:int, param2:Boolean = false) : void
        {
            rmi.iRolePrx.upgradeRune_async(new AMI_IRole_upgradeRune(), param1, param2);
            return;
        }// end function

        public function saveClientSetting(param1:int, param2:String) : void
        {
            rmi.iRolePrx.saveClientSetting_async(new AMI_IRole_saveClientSetting(), param1, param2);
            return;
        }// end function

        public function useDrugBag(param1:int, param2:String = "") : void
        {
            if (GameMapUtil.isDrugDisavailableMap)
            {
                return;
            }
            rmi.iRolePrx.useDrugBag_async(new AMI_IRole_useDrugBag(this.useDrugBagSuccess, this.useFalse, param1), param1, param2);
            return;
        }// end function

        private function useDrugBagSuccess(param1:AMI_IRole_useDrugBag) : void
        {
            Log.debug("使用药包成功");
            var _loc_2:* = param1.userObject as int;
            var _loc_3:* = Cache.instance.cd.getCDData(DrugPackUtil.getCdKeyByType(_loc_2), CDDataType.itemData);
            _loc_3.beginTime = 0;
            _loc_3.startCoolDown();
            NetDispatcher.dispatchCmd(ServerCommand.BackPackDrugItemSuccess, DrugPackUtil.getCdKeyByType(_loc_2));
            return;
        }// end function

        private function useFalse(param1:Exception) : void
        {
            Log.debug(param1.code, ErrorCode.getErrorStringByCode(param1.code), param1.message);
            return;
        }// end function

        public function singleZazen() : void
        {
            rmi.iRolePrx.startZazen_async(new AMI_IRole_startZazen());
            return;
        }// end function

        public function inviteDoubleZazen(param1:Array) : void
        {
            rmi.iRolePrx.inviteDoubleZazen_async(new AMI_IRole_inviteDoubleZazen(), param1);
            return;
        }// end function

        public function replyDoubleZazen(param1:SEntityId, param2:Boolean) : void
        {
            rmi.iRolePrx.replyDoubleZazen_async(new AMI_IRole_replyDoubleZazen(), param1, param2);
            return;
        }// end function

        public function hideOrShowFashion(param1:int) : void
        {
            rmi.iRolePrx.hideOrShowFashion_async(new AMI_IRole_hideOrShowFashion(), param1);
            return;
        }// end function

        public function getHalidomInfo() : void
        {
            var getHalidomInfoSucceed:Function;
            getHalidomInfoSucceed = function (param1:AMI_IRole_getHalidomInfo, param2:Array) : void
            {
                cache.halidom.initData(param2);
                NetDispatcher.dispatchCmd(ServerCommand.HalidomInfoRes, null);
                return;
            }// end function
            ;
            rmi.iRolePrx.getHalidomInfo_async(new AMI_IRole_getHalidomInfo(getHalidomInfoSucceed));
            return;
        }// end function

        public function commitHalidomPieces(param1:int) : void
        {
            var commitHalidomPiecesSucceed:Function;
            var halidomId:* = param1;
            commitHalidomPiecesSucceed = function (param1:AMI_IRole_commitHalidomPieces) : void
            {
                GameProxy.role.getHalidomInfo();
                return;
            }// end function
            ;
            rmi.iRolePrx.commitHalidomPieces_async(new AMI_IRole_commitHalidomPieces(commitHalidomPiecesSucceed), halidomId);
            return;
        }// end function

        public function upgradeHalidom(param1:int) : void
        {
            var upgradeHalidomSucceed:Function;
            var halidomId:* = param1;
            upgradeHalidomSucceed = function (param1:AMI_IRole_upgradeHalidom) : void
            {
                var _loc_2:* = cache.halidom.getItemById(halidomId);
                var _loc_3:* = cache.halidom.getItemById(halidomId).level + 1;
                _loc_2.level = _loc_3;
                NetDispatcher.dispatchCmd(ServerCommand.HalidomInfoRes, null);
                return;
            }// end function
            ;
            rmi.iRolePrx.upgradeHalidom_async(new AMI_IRole_upgradeHalidom(upgradeHalidomSucceed), halidomId);
            return;
        }// end function

        public function getDailyReward() : void
        {
            var getDailyRewardSucceed:Function;
            getDailyRewardSucceed = function (param1:AMI_IRole_getDailyReward) : void
            {
                NetDispatcher.dispatchCmd(ServerCommand.DailyRewardGetSucceed, null);
                cache.daily.index = DailyUtil.dailyRewardIndex;
                return;
            }// end function
            ;
            rmi.iRolePrx.getDailyReward_async(new AMI_IRole_getDailyReward(getDailyRewardSucceed));
            return;
        }// end function

        public function getFinalTestReward(param1:int) : void
        {
            if (this._finalTestRewardId > 0)
            {
                return;
            }
            this._finalTestRewardId = param1;
            rmi.iRolePrx.getFinalTestReward_async(new AMI_IRole_getFinalTestReward(this.onGetFinalTestReward), this._finalTestRewardId);
            return;
        }// end function

        private function onGetFinalTestReward(param1:AMI_IRole_getFinalTestReward) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ClosedBetaGiftBagFlyToPack, this._finalTestRewardId));
            this._finalTestRewardId = -1;
            return;
        }// end function

        public function activeNewbieCode(param1:String) : void
        {
            rmi.iRolePrx.activeNewbieCode_async(new AMI_IRole_activeNewbieCode(this.activeSucc, this.activeFail), param1);
            return;
        }// end function

        private function activeSucc(param1:AMI_IRole_activeNewbieCode) : void
        {
            return;
        }// end function

        private function activeFail(param1:Exception) : void
        {
            MsgManager.showMouseMsg(ErrorCode.getErrorStringByCode(param1.code), MsgRollTipsType.msgRollTips3);
            return;
        }// end function

        public function digTreasureMap(param1:int) : void
        {
            rmi.iRolePrx.digTreasureMap_async(new AMI_IRole_digTreasureMap(this.digSucc, this.digFail), EDigTreasureOperate.convert(param1));
            return;
        }// end function

        private function digSucc(param1:AMI_IRole_digTreasureMap, param2:EDigTreasureResult, param3:int) : void
        {
            var _loc_4:Object = {result:param2, id:param3};
            if (Global.isDebugModle)
            {
                MsgManager.showRollTipsMsg(Language.getStringByParam(20591, param2.__value, param3));
            }
            MsgManager.showRollTipsMsg(Language.getString(20592));
            NetDispatcher.dispatchCmd(ServerCommand.TreasureMapResult, _loc_4);
            return;
        }// end function

        private function digFail(param1:Exception) : void
        {
            if (Global.isDebugModle)
            {
                MsgManager.showRollTipsMsg(Language.getString(20593));
            }
            return;
        }// end function

        public function getRechargeTargetReward(param1:int) : void
        {
            rmi.iRolePrx.getRechargeReturnReward_async(new AMI_IRole_getRechargeReturnReward(this.getRechargeTargetSuccess, null), param1);
            return;
        }// end function

        private function getRechargeTargetSuccess(param1:AMI_IRole_getRechargeReturnReward, param2:int) : void
        {
            Cache.instance.rebate.getDayRechargeBack(param2);
            NetDispatcher.dispatchCmd(ServerCommand.RebateDayChargeGetRewardBack, param2);
            return;
        }// end function

        private function getRechFaill(param1:Exception) : void
        {
            if (Global.isDebugModle)
            {
                MsgManager.showRollTipsMsg(Language.getString(20594));
            }
            return;
        }// end function

        public function getCollectReward() : void
        {
            rmi.iRolePrx.getCollectReward_async(new AMI_IRole_getCollectReward());
            return;
        }// end function

        public function getDayFirstReward() : void
        {
            rmi.iRolePrx.getDayFirstReward_async(new AMI_IRole_getDayFirstReward(this.getFirstRechardScusses));
            return;
        }// end function

        private function getFirstRechardScusses(param1:AMI_IRole_getDayFirstReward) : void
        {
            var _loc_2:* = Cache.instance.firstRecharge.firstRechargeRewardInfo;
            if (_loc_2)
            {
                _loc_2.isGet = 1;
            }
            if (FirstRechargeDailyModule.isViewShow)
            {
                FirstRechargeDailyModule.instance.hide();
            }
            if (FirstRechargeModule.isViewShow)
            {
                FirstRechargeModule.instance.hide();
            }
            if (FirstReChargeIcon.isViewShow)
            {
                FirstReChargeIcon.instance.hide();
            }
            NetDispatcher.dispatchCmd(ServerCommand.FirstRechargeRewardHasGet, _loc_2);
            return;
        }// end function

        public function changeToCareer(param1:int) : void
        {
            rmi.iRolePrx.changeCareer_async(new AMI_IRole_changeCareer(), param1);
            return;
        }// end function

        public function changeName(param1:String, param2:String) : void
        {
            rmi.iRolePrx.changeName_async(new AMI_IRole_changeName(), param1, param2);
            return;
        }// end function

        public function getCompoundItem(param1:int, param2:Dictionary, param3:int) : void
        {
            rmi.iRolePrx.getCompoundItem_async(new AMI_IRole_getCompoundItem(this.comPoundScuss), param1, param2, param3);
            return;
        }// end function

        private function comPoundScuss(param1:AMI_IRole_getCompoundItem) : void
        {
            NetDispatcher.dispatchCmd(ServerCommand.ComPoundScuss, null);
            return;
        }// end function

        public function getConsumReward() : void
        {
            rmi.iRolePrx.getConsumReward_async(new AMI_IRole_getConsumReward());
            return;
        }// end function

        public function getExperWingShapeCard() : void
        {
            rmi.iRolePrx.getExperWingShapeCard_async(new AMI_IRole_getExperWingShapeCard(this.getWingScuess));
            return;
        }// end function

        private function getWingScuess(param1:AMI_IRole_getExperWingShapeCard) : void
        {
            Cache.instance.vip.isCanGetWin = false;
            NetDispatcher.dispatchCmd(ServerCommand.FirstRechargeWingGet, null);
            return;
        }// end function

        public function getMegerRechargeActiveReward(param1:int) : void
        {
            rmi.iRolePrx.getMegerRechargeActiveReward_async(new AMI_IRole_getMegerRechargeActiveReward(this.getMegerRechargeActiveRewardScuess), param1);
            return;
        }// end function

        private function getMegerRechargeActiveRewardScuess(param1:AMI_IRole_getMegerRechargeActiveReward, param2:int) : void
        {
            Cache.instance.combinedSer.rechargBack(param2);
            NetDispatcher.dispatchCmd(ServerCommand.CombinedSerRechargeInfo, null);
            return;
        }// end function

        public function getMegerRechargeReturnCash() : void
        {
            rmi.iRolePrx.getMegerRechargeReturnCash_async(new AMI_IRole_getMegerRechargeReturnCash(this.getMegerRechargeReturnCashScuess));
            return;
        }// end function

        private function getMegerRechargeReturnCashScuess(param1:AMI_IRole_getMegerRechargeReturnCash, param2:int) : void
        {
            Cache.instance.combinedSer.recharg1000Back(param2);
            NetDispatcher.dispatchCmd(ServerCommand.CombinedSerRecharge1000Info, null);
            return;
        }// end function

        public function getMegerRechargeTopList() : void
        {
            rmi.iRolePrx.getMegerRechargeTopList_async(new AMI_IRole_getMegerRechargeTopList(this.getMegerRechargeTopListScuess));
            return;
        }// end function

        private function getMegerRechargeTopListScuess(param1:AMI_IRole_getMegerRechargeTopList, param2:Array) : void
        {
            Cache.instance.combinedSer.rankList = param2;
            NetDispatcher.dispatchCmd(ServerCommand.CombinedSerRankInfo, null);
            return;
        }// end function

        public function getThanksGivingConsumReward(param1:int) : void
        {
            rmi.iRolePrx.getThanksGivingConsumReward_async(new AMI_IRole_getThanksGivingConsumReward(this.getThanksGivingConsumRewardScuess), param1);
            return;
        }// end function

        private function getThanksGivingConsumRewardScuess(param1:AMI_IRole_getThanksGivingConsumReward, param2:int) : void
        {
            Cache.instance.thanksGiving.rechargBack(param2);
            NetDispatcher.dispatchCmd(ServerCommand.ThanksGivingConsumInfo, null);
            return;
        }// end function

    }
}
